<?php
namespace App\Repositories\Main;

use App\Models\Main\ComCostTypeModel;
use App\Repositories\BaseRepository;

class ComCostTypeRepository extends BaseRepository
{
    protected $repository;

    public function __construct()
    {
        $this->repository = new ComCostTypeModel();
    }

    public function setAdd($data)
    {
        return $this->repository->insertGetId($data);
    }

    public function setModify($data,$id)
    {
        return $this->repository->where('id',$id)
            ->update($data);
    }

    public function setModifyByUid($data,$uid)
    {
        return $this->repository->where('uid',$uid)
            ->update($data);
    }

    public function getShowOne($id)
    {
        return $this->repository->where('id',$id)->first();
    }

    public function getShowByUid($uid)
    {
        return $this->repository
            ->where('uid',$uid)
            ->get();
    }

    public function getShowByName($uid,$typeName)
    {
        return $this->repository
            ->where('uid',$uid)
            ->where('name',$typeName)
            ->first();
    }
}